From: Julien Grall Date: Tue, 30 Sep 2014 14:56:53 +0000 (+0100) Subject: xen/arm64: Make show_registers working even if current is not correctly set X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~4289 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=0e96ab2691e4e83e4e89f826e0d605d5991e1bfa;p=xen.git xen/arm64: Make show_registers working even if current is not correctly set The commit 8ab802c "xen/arm: Restricted access to IFSR32_EL2 and FPEXC32_EL2" introduced the use of the variable current in show_registers. The variable is not correctly set until Xen has finished to boot. Therefore any call to show_registers will result to crash Xen. As the register IFSR32_EL2 is only printed when the registers represent a guest view, Xen can read the value only for this case. Signed-off-by: Julien Grall Acked-by: Ian Campbell --- diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 55f6b8fa01..f6fc8f8e1e 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -791,7 +791,7 @@ void show_registers(struct cpu_user_regs *regs) #else ctxt.far = READ_SYSREG(FAR_EL1); ctxt.esr_el1 = READ_SYSREG(ESR_EL1); - if ( is_32bit_domain(current->domain) ) + if ( guest_mode(regs) && is_32bit_domain(current->domain) ) ctxt.ifsr32_el2 = READ_SYSREG(IFSR32_EL2); #endif ctxt.vttbr_el2 = READ_SYSREG64(VTTBR_EL2);